<script setup>
import { onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { isLogin } from '@/utils/auth'

const router = useRouter()

onMounted(() => {
  // 根据是否已登录，跳转到对应页面
  if (isLogin())
    router.replace({ name: 'Outbound' })
  else
    router.replace('/login')
})
</script>

<template>
  <div class="loading-page">
    <div class="loading-content">
      <div class="spinner"></div>
      <p>正在跳转到登录页面...</p>
    </div>
  </div>
</template>

<style scoped>
.loading-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.loading-content {
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

p {
  margin: 0;
  font-size: 16px;
  opacity: 0.9;
}
</style>

<route lang="json5">
{
  name: 'Index',
  meta: {
    title: '首页'
  }
}
</route>
